/* 基础样式 */
:root {
    --jc-primary: #3f51b5;
    --jc-primary-hover: #303f9f;
    --jc-danger: #ff4444;
    --jc-danger-hover: #cc0000;
    --jc-success: #4CAF50;
    --jc-success-hover: #388E3C;
    --jc-warning: #FF9800;
    --jc-warning-hover: #F57C00;
    --jc-info: #2196F3;
    --jc-info-hover: #1976D2;
    --jc-text: #333;
    --jc-text-light: #666;
    --jc-background: #fff;
    --jc-border: #e0e0e0;
    --jc-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --jc-radius: 12px;
    --jc-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --jc-blur: blur(10px);
    --jc-modal-width: 500px;
    --jc-modal-small: 300px;
    --jc-modal-large: 800px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --jc-text: #fff;
        --jc-text-light: #ccc;
        --jc-background: #1e1e1e;
        --jc-border: #444;
        --jc-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--jc-background);
    color: var(--jc-text);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

/* 弹窗容器 */
.jc-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    pointer-events: none;
}

/* 遮罩层 */
.jc-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: var(--jc-blur);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: auto;
}

/* 弹窗内容容器 */
.jc-modal__container {
    position: relative;
    background: var(--jc-background);
    margin: 20vh auto;
    padding: 24px;
    width: 90%;
    max-width: var(--jc-modal-width);
    border-radius: var(--jc-radius);
    box-shadow: var(--jc-shadow);
    transform: translateY(-30px);
    opacity: 0;
    transition: var(--jc-transition);
    pointer-events: auto;
    z-index: 1001;
}

.jc-modal__container--small {
    max-width: var(--jc-modal-small);
}

.jc-modal__container--large {
    max-width: var(--jc-modal-large);
}

.jc-modal__container--fullscreen {
    max-width: 95%;
    width: 95%;
    height: 90vh;
    margin: 5vh auto;
    overflow: auto;
}

.jc-modal__container--draggable {
    cursor: move;
    user-select: none;
}

/* 弹窗激活状态 */
.jc-modal--active {
    display: block;
}

.jc-modal--active .jc-modal__overlay {
    opacity: 1;
}

.jc-modal--active .jc-modal__container {
    transform: translateY(0);
    opacity: 1;
}

/* 弹窗关闭动画 */
.jc-modal--closing .jc-modal__overlay {
    opacity: 0;
}

.jc-modal--closing .jc-modal__container {
    animation: fadeOutDown 0.5s ease-out forwards;
}

/* 弹窗标题 */
.jc-modal__title {
    margin: 0 0 16px;
    font-size: 24px;
    font-weight: 500;
    color: var(--jc-text);
}

/* 弹窗内容 */
.jc-modal__content {
    margin: 16px 0;
    font-size: 16px;
    line-height: 1.5;
    color: var(--jc-text-light);
    max-height: 60vh;
    overflow-y: auto;
}

/* 弹窗表单 */
.jc-modal__form {
    margin: 16px 0;
}

.jc-modal__form-group {
    margin-bottom: 16px;
}

.jc-modal__form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--jc-text);
}

.jc-modal__form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--jc-border);
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    background: var(--jc-background);
    color: var(--jc-text);
}

.jc-modal__form-input:focus {
    border-color: var(--jc-primary);
    outline: none;
}

/* 弹窗按钮区域 */
.jc-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 24px;
    flex-wrap: wrap;
}

/* 弹窗按钮 */
.jc-modal__button {
    background: var(--jc-primary);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--jc-transition);
    flex: 1 1 auto;
    margin: 4px;
    min-width: 100px;
    text-align: center;
}

.jc-modal__button:hover {
    background: var(--jc-primary-hover);
    transform: translateY(-2px);
}

.jc-modal__button:active {
    transform: translateY(0);
}

.jc-modal__button:focus {
    outline: 2px solid rgba(63, 81, 181, 0.5);
}

.jc-modal__button--danger {
    background: var(--jc-danger);
}

.jc-modal__button--danger:hover {
    background: var(--jc-danger-hover);
}

.jc-modal__button--success {
    background: var(--jc-success);
}

.jc-modal__button--success:hover {
    background: var(--jc-success-hover);
}

.jc-modal__button--warning {
    background: var(--jc-warning);
}

.jc-modal__button--warning:hover {
    background: var(--jc-warning-hover);
}

.jc-modal__button--info {
    background: var(--jc-info);
}

.jc-modal__button--info:hover {
    background: var(--jc-info-hover);
}

.jc-modal__button--outline {
    background: transparent;
    border: 1px solid var(--jc-primary);
    color: var(--jc-primary);
}

.jc-modal__button--outline:hover {
    background: rgba(63, 81, 181, 0.1);
}

/* 关闭按钮 */
.jc-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: var(--jc-text-light);
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.jc-modal__close:hover {
    color: var(--jc-text);
    background: rgba(0, 0, 0, 0.1);
}

/* 加载状态 */
.jc-modal__loading {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    border-radius: var(--jc-radius);
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.jc-modal__loading--active {
    display: flex;
}

.jc-spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top: 4px solid var(--jc-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

/* 图标 */
.jc-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-right: 8px;
}

/* 动画 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOutDown {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(20px);
    }
}

@keyframes slideInRight {
    0% {
        opacity: 0;
        transform: translateX(20px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    0% {
        opacity: 0;
        transform: translateX(-20px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 移动端优化 */
@media (max-width: 768px) {
    .jc-modal__container {
        margin: 10vh auto;
        padding: 16px;
        width: 95%;
    }

    .jc-modal__title {
        font-size: 20px;
    }

    .jc-modal__content {
        font-size: 14px;
    }

    .jc-modal__button {
        padding: 10px 16px;
        font-size: 13px;
        min-width: 80px;
    }

    .jc-modal__container--fullscreen {
        height: 95vh;
        margin: 2.5vh auto;
    }
}

/* Toast 提示条样式 */
.jc-toast {
    position: fixed;
    max-width: 360px;
    width: 90%;
    padding: 16px 24px;
    border-radius: 8px;
    background: var(--jc-background);
    box-shadow: var(--jc-shadow);
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transform: translateY(20px);
    transition: var(--jc-transition);
    z-index: 9999;
    pointer-events: auto;
}

.jc-toast--active {
    opacity: 1;
    transform: translateY(0);
}

.jc-toast--top-center {
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
}

.jc-toast--bottom-center {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
}

.jc-toast--top-right {
    top: 20px;
    right: 20px;
    transform: translateX(20px);
}

.jc-toast--top-left {
    top: 20px;
    left: 20px;
    transform: translateX(-20px);
}

.jc-toast--bottom-right {
    bottom: 20px;
    right: 20px;
    transform: translateX(20px);
}

.jc-toast--bottom-left {
    bottom: 20px;
    left: 20px;
    transform: translateX(-20px);
}

.jc-toast--active.jc-toast--top-center,
.jc-toast--active.jc-toast--bottom-center {
    transform: translateX(-50%) translateY(0);
}

.jc-toast--active.jc-toast--top-right,
.jc-toast--active.jc-toast--bottom-right,
.jc-toast--active.jc-toast--top-left,
.jc-toast--active.jc-toast--bottom-left {
    transform: translateX(0);
}

.jc-toast__icon {
    font-size: 20px;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.jc-toast__content {
    flex-grow: 1;
    font-size: 14px;
    line-height: 1.4;
    color: var(--jc-text);
}

.jc-toast__close {
    background: none;
    border: none;
    color: var(--jc-text-light);
    cursor: pointer;
    padding: 4px;
    margin-left: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 24px;
    height: 24px;
}

.jc-toast__close:hover {
    color: var(--jc-text);
    background: rgba(0, 0, 0, 0.1);
}

/* 类型修饰符 */
.jc-toast--success {
    border-left: 4px solid #4CAF50;
}

.jc-toast--error {
    border-left: 4px solid #f44336;
}

.jc-toast--warning {
    border-left: 4px solid #FF9800;
}

.jc-toast--info {
    border-left: 4px solid var(--jc-primary);
}

.jc-toast--success .jc-toast__icon { color: #4CAF50; }
.jc-toast--error .jc-toast__icon { color: #f44336; }
.jc-toast--warning .jc-toast__icon { color: #FF9800; }
.jc-toast--info .jc-toast__icon { color: var(--jc-primary); }

/* Toast 队列动画 */
.jc-toast-queue {
    position: fixed;
    right: 20px;
    top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
    pointer-events: none;
}

@media (max-width: 480px) {
    .jc-toast {
        width: 95%;
        padding: 12px 16px;
    }
    
    .jc-toast-queue {
        right: 10px;
        left: 10px;
        top: 10px;
        align-items: center;
    }
}